package org.jeecg.modules.nc.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.nc.enums.WSEnum;
import org.jeecg.common.nc.service.NCWebService;
import org.jeecg.common.nc.vo.WSVO;
import org.springframework.web.bind.annotation.*;

/**
 * @Description: 供应商表
 * @Author: qixin-boot
 * @Date:   2021-06-29
 * @Version: V1.0
 */
@Api(tags="NC接口类")
@RestController
@RequestMapping("/nc/webservice")
@Slf4j
public class NCWebServiceController {

    // "NC服务器地址"
    private static final String serverpath = "http://10.10.30.34:8888";

    /**
     *
     *
     * @return
     */
    @AutoLog(value = "NC-组织同步")
    @ApiOperation(value="NC-组织同步", notes="NC-组织同步")
    @GetMapping(value = "/syncorg")
    public Result<?> syncorg() {
        WSVO vo = null;
        try {
            vo = NCWebService.getFromWS(serverpath, WSEnum.ZUZHI,"2008-01-01 00:00:00");
        } catch (Exception e) {
            e.printStackTrace();
            return Result.error("同步组织失败：" + e.getMessage());
        }
        return Result.OK(vo);
    }

}
